package cn.wolfcode.luowowo.article.service.impl;


import cn.wolfcode.luowowo.acticle.domain.ScenicSpot;
import cn.wolfcode.luowowo.acticle.query.ScenicSpotQuery;
import cn.wolfcode.luowowo.acticle.service.IScenicSpotService;
import cn.wolfcode.luowowo.article.mapper.ScenicSpotMapper;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class IScenicSpotServiceImpl implements IScenicSpotService {
    @Autowired
    private ScenicSpotMapper scenicSpotMapper;

    @Override
    public PageInfo query(ScenicSpotQuery qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<ScenicSpot> list= scenicSpotMapper.selectForList(qo);

        return new PageInfo(list);
    }

    @Override
    public List<ScenicSpot> queryTop5(ScenicSpotQuery qo) {
        return scenicSpotMapper.selectTop5(qo);
    }

    @Override
    public List<ScenicSpot> queryHot10(ScenicSpotQuery qo) {
        return scenicSpotMapper.selectHot10(qo);
    }

    @Override
    public ScenicSpot get(Long detailId) {
        return scenicSpotMapper.selectByPrimaryKey(detailId);
    }

    @Override
    public ScenicSpot getByDestId(long destId) {
        return scenicSpotMapper.selectByDestId(destId);
    }

    @Override
    public ScenicSpot getDestByScenicId(Long scenicId) {

        return scenicSpotMapper.selectByScenicId(scenicId);
    }
}
